<!-- 模态窗口编辑模板 -->
<form action="" id="myform" class="form-horizontal form-bordered" novalidate="novalidate" method="post">
<!-- 窗口标题开始 -->
<div class="modal-header">
	<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
	<h4 class="modal-title">品目设置</h4>
</div>
<!-- 窗口标题结束-->
<!-- 内容开始 -->
<form role="form" class="form-horizontal" id="myFormItems" name="myFormItems">
<div class="modal-body">
	<div class="portlet-body form">
		<div class="form-body">
			<div class="form-group form-md-radios" style="padding-left: 50px;">
				<div class="md-radio-inline">
					<#list listItems as items>
						<div class="md-radio">
							<input type="radio" id="radio${items.id}" name="itemId" class="md-radiobtn" style="visibility:visible;" value="${items.id?c}" 
							<#if items.id == userItemId>
								checked="checked"
							</#if> >
							<label for="radio${items.id}" style="white-space:nowrap; ">
							${items.name} </label>
						</div>
				    </#list>
				    <input type="hidden" id="userItemId" value="${userItemId}" >
				</div>
			</div>
		</div>
	</div>
</div>
</form>
<!-- 内容结束 -->
<!-- 底部按钮开始 -->
<div class="modal-footer">
	<button type="button" class="btn default fa fa-times" data-dismiss="modal"> 关闭</button>
	<button type="button" class="btn green  fa fa-check" onclick="submitForm();"> 提交</button>
</div>
<!-- 结束 -->
</form>
<!-- 业务处理开始 -->
<script>
	
	function submitForm(){
		var itemId=$('input[name="itemId"]:checked ').val();
		//后台提交
		$.ajax({
        		type: "POST",
        		url: BASE_URL+"/user/updateItem.do?itemId="+itemId,
        		dataType: "json",
        		success: function(res){
        			if(res.code=="succ"){ 
        				$(".editModal").modal('hide');
        				$(".editModal").empty();
        				delCookie("price");
        				CommonUtils.succModal2('系统提示','设置成功,请关闭并重新打开撮合客户端',BASE_URL+'/user/loginSucc.do');
        			}
        			else {
        				CommonUtils.succModal('系统提示','设置失败，请稍后重试或联系管理员');
        			}
        		}
       });
	}
</script>